import Components from 'unplugin-vue-components/vite';
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import ReactivityTransform from '@vue-macros/reactivity-transform';

// console.log('ReactivityTransform:', ReactivityTransform);
// 从 ReactivityTransform 对象中获取适用于 Vite 的插件函数
const viteReactivityTransform = ReactivityTransform.vite;

export default defineNuxtConfig({
  rootDir: '.',
  compatibilityDate: '2025-04-05',
  vite: {
    plugins: [
      Components({
        resolvers: [AntDesignVueResolver({ importStyle: 'less', resolveIcons: true })],
      }),
      viteReactivityTransform(), // 使用获取到的 Vite 插件函数,
    ],
    // 配置全局less预处理器
    css: {
      preprocessorOptions: {
        less: {
          javascriptEnabled: true,
        },
      },
    },
  },
  typescript: {
    // 确保类型定义正确
    typeCheck: true,
    tsConfig: {
        compilerOptions: {
            types: ["@vue-macros/reactivity-transform/macros-global"]
        }
    }
  },
  modules: ['@pinia/nuxt', '@unocss/nuxt'],
  devtools: {
    enabled: false
  }
    
})

